home *** CD-ROM | disk | FTP | other *** search
- { %filename% }
- { Created %date% %time% by AppMaker }
-
- Unit %unitname%;
- Interface
-
- %if lang = MPW%
- Uses
- Types,
- Quickdraw,
- Controls,
- Dialogs,
- Events,
- Lists,
- Menus,
- TextEdit;
-
- %end if%
- type
- WinInfoRec = record
- {Standard fields:}
- text: TEHandle;
- vScroll: ControlHandle;
- hScroll: ControlHandle;
- fileNum: integer;
- volNum: integer;
- dirty: boolean;
- filename: StringHandle;
- windowKind: (noWindow%for each window gen windowKind%, fillerWK);
- witlHandle: Handle; {Window itemlist resource}
- wictHandle: Handle; {Window item color table resource}
-
- {Application-specific fields:}
- %for each window gen windowFields%
-
- end; {WinInfoRec}
- WinInfoPtr = ^WinInfoRec;
-
- type
- SysConfigRec = record
- hasGestalt: boolean;
- hasWNE: boolean;
- hasColorQD: boolean;
- hasAppleEvents: boolean;
- hasEditionMgr: boolean;
- end;
-
- var
- quittingTime: boolean;
- curEvent: EventRecord;
- curWindow: WindowPtr;
- cur: WinInfoPtr;
- inBackground: boolean;
- sysConfig: SysConfigRec;
-
- {your application-specific variables:}
-
- {----------}
- Procedure InitGlobals;
- Procedure SetInfo (window: WindowPtr);
- Procedure SetNewInfo (window: WindowPtr);
- Procedure DiscardInfo (window: WindowPtr);
-
- {----------}
- Implementation
-
- %if lang = MPW%
- {$D+}
- {$R+}
- {$OV+}
- {$S %unitname%}
-
- %end if%
- var
- noCur: WinInfoRec;
-
- {----------}
- Procedure InitGlobals;
- Begin
- curWindow := nil;
- with noCur do begin
- text := nil;
- vScroll := nil;
- hScroll := nil;
- fileNum := 0;
- volNum := 0;
- dirty := false;
- windowKind := noWindow;
- end; {with}
- cur := @noCur;
- End; {InitGlobals}
-
- {----------}
- Procedure SetInfo (window: WindowPtr);
- var
- infoPtr: WinInfoPtr;
- Begin
- if window <> curWindow then begin
- curWindow := window;
- if curWindow <> nil then begin
- infoPtr := WinInfoPtr (GetWRefCon (curWindow));
- cur := infoPtr;
- end else begin
- cur := @noCur;
- end;
- end;
- End; {SetInfo}
-
- {----------}
- Procedure SetNewInfo (window: WindowPtr);
- var
- infoPtr: WinInfoPtr;
- Begin
- infoPtr := WinInfoPtr (NewPtr (sizeof (WinInfoRec)));
- SetWRefCon (window, longint (infoPtr));
- SetInfo (window);
- End; {SetNewInfo}
-
- {----------}
- Procedure DiscardInfo (window: WindowPtr);
- var
- infoPtr: WinInfoPtr;
- Begin
- if window = curWindow then begin
- SetInfo (nil);
- end;
- infoPtr := WinInfoPtr (GetWRefCon (window));
- DisposPtr (Ptr (infoPtr));
- HideWindow (window);
- DisposeWindow (window);
- End; {DiscardInfo}
-
- End. {%unitname%}
-
-